package jiwei.controller;

import jiwei.config.RefererCheckProperties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@ResponseBody
@Controller
public class HelloController {
    Logger log = LoggerFactory.getLogger(getClass());

    @Value("${referer.enabled:false}")
    private Boolean referer_enabled;
    @Value("${referer.domains:}")
    private List<String> referer_domains;

    @Autowired
    RefererCheckProperties refererCheckProperties;

    @RequestMapping("/hello")
    public String hello() {
        return "hello，" + refererCheckProperties.getEnabled() + " , " + refererCheckProperties.getDomains()
                + referer_enabled + " , " + referer_domains;
    }
}
